/**
 * 
 */
package picturemouse;

import java.io.Serializable;

public class Booking implements Serializable {

    private final int bookingID;
    private String customerName;
    private int screeningID;
    private int seatID;
    
    public Booking(int bookingID) {
        this.bookingID = bookingID;
        customerName = "";
        screeningID = 0;
        seatID = 0;
    }

    /**
     Method to set the details of the booking and check that the seat is avaliable
     * @param screeningID
     * @param customerName
     * @param seatID
     * @throws picturemouse.SeatNotAvaliableException
     * @throws picturemouse.ScreeningNotFoundException
     */
    public void makeBooking(int screeningID, String customerName, int seatID, PictureMouse pictureMouse) throws SeatNotAvaliableException, ScreeningNotFoundException {
        //Get the screening object from the ID
        Screening screening = pictureMouse.getScreeningByID(screeningID);
        //Book the seat for the screening
        screening.bookSeat(seatID, pictureMouse);
        //Update the booking info
        this.screeningID = screeningID;
        this.customerName = customerName;
        this.seatID = seatID;
    }

    /*
    Method to return the booking ID
    */
    public int getID() {
        return bookingID;
    }
    
    /*
    Method to return the customer name
    */
    public String getCustomerName() {
        return customerName;
    }
    
    /*
    Method to return the screening ID
    */
    public int getScreeningID() {
        return screeningID;
    }
    
    /*
    Method to return the booking ID
    */
    public int getSeatID() {
        return seatID;
    }
}
